}
/*
VMM uses put_user to copy pfn_list to guest buffer, this maybe fail,
- VMM don't handle this now.
+ VMM doesn't handle this now.
This method will touch guest buffer to make sure the buffer's mapping
is tracked by VMM,
*/
unsigned int __start_page, __nr_pages;
unsigned long max_pfns;
unsigned long *__pfn_buf;
+
__start_page = start_page;
__nr_pages = nr_pages;
__pfn_buf = pfn_buf;
op.cmd = DOM0_GETMEMLIST;
op.u.getmemlist.domain = (domid_t)domid;
op.u.getmemlist.max_pfns = max_pfns;
+ op.u.getmemlist.num_pfns = 0;
set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf);
if ( (max_pfns != -1UL)
put_domain(d);
}
break;
- /*
- * NOTE: DOM0_GETMEMLIST has somewhat different semantics on IA64 -
- * it actually allocates and maps pages.
- */
+
case DOM0_GETMEMLIST:
{
unsigned long i = 0;
ret = -ENOMEM;
op->u.getmemlist.num_pfns = i - start_page;
- copy_to_guest(u_dom0_op, op, 1);
+ if (copy_to_guest(u_dom0_op, op, 1))
+ ret = -EFAULT;
put_domain(d);
}